#ifndef __CORE_MESSAGE_H__
#define __CORE_MESSAGE_H__

enum CMD
{
	CMD_LOGIN = 1,
	CMD_LOGIN_RESULT,
	CMD_LOGOUT,
	CMD_LOGOUT_RESULT,
	CMD_NEW_CLIENT,
	CMD_ERROR
};

struct DataHeader
{
	DataHeader()
	{
		cmd = CMD_ERROR;
		dataLength = sizeof(DataHeader);
	}
	short cmd;
	short dataLength;
};

struct Login : public DataHeader
{
	Login()
	{
		cmd = CMD_LOGIN;
		dataLength = sizeof(Login);
	}
	char username[32];
	char passwd[32];
	char data[932];
};

struct LoginResult : public DataHeader
{
	LoginResult()
	{
		cmd = CMD_LOGIN_RESULT;
		dataLength = sizeof(LoginResult);
	}
	short result;
};

struct Logout : public DataHeader
{
	Logout()
	{
		cmd = CMD_LOGOUT;
		dataLength = sizeof(Logout);
	}
	char username[32];
};

struct LogoutResult :public DataHeader
{
	LogoutResult()
	{
		cmd = CMD_LOGOUT_RESULT;
		dataLength = sizeof(LogoutResult);
	}
	short result;
};

struct NewClientLogin :public DataHeader
{
	NewClientLogin()
	{
		cmd = CMD_NEW_CLIENT;
		dataLength = sizeof(NewClientLogin);
	}
	short result;
};

#endif // !__CORE_MESSAGE_H__